/*******************************************************************************
 * @doc VCS
 * @module VCSSrc.C |
 * Source code for the VCS communication functions.
 *
 * Product         :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   Rannie_B1
 * <nl>Notes       :
 *
 * @head3 VCS Functions |
 * @index | VCS
 * @end
 *
 * Copyright (c) 2004-2012 by VeriFone Inc. All rights reserved.
 *
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form
 * or by any means whether electronic, mechanical, magnetic, optical,
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
$Log: /SoftPay/SPK2SIM/Source/VCSSrc/VCSSrc.c $
 * ------------------------------------------------------------------------
 ********************************************************************************/

#include <stdio.h>
#include <acldev.h>
#include <aclutil.h>
#include <xmodem.h>
#include <string.h>
#include <txoinc.h>
#include <aclconio.h>


#include <project.h>
///**/#define DEBUG_VSCOMM/**/
#ifdef DEBUG_VSCOMM
 #define DEBUG_95
#endif

#include <define.h>
#include <modem.h>
#include <comm.h>
#include <spdebug.h>
#include <tct.h>
#include <confio.h>
#include <funcids.h>
#include <msg.h>
#include <msgfuncs.h>
#include <mdlfuncs.h>
#include <operate.h>
#include <ui.h>
#include <modemmsg.h>
#include <isdn.h>
#include <dp3201.h>
#include <dp3101.h>
#include <mbtx2.h>
#include <spdmodem.h>
//#include <codesec.h>
#include <gds.h>
#include <logsys.h>
#include <table.h>
#include <validt.h>

#include "VCSsrc.h"
#include "VCSids.h"
#include "CSclnt.h"

/* ----------------------------------------------------------------------------
   Name 		: vdAddVCSFunctions
   Parameters	: none
   Description	: Sets the function pointers and the link type in the communication object
   Returns	: nothing
   ----------------------------------------------------------------------------
   History:
   August 27, 2004 - This function was created (Rannie_B1)
   ---------------------------------------------------------------------------- */
void vdAddVCSFunctions( void )
{
   	inAddFunctionPointer(VCS_COMM_LINK_VAL, (PFI_TO)inVCSCommLinkValidate);
	inAddFunctionPointer(CHECK_WIFI_STATUS, inCheckStatus);
	inAddFunctionPointer(INIT_COMM_SERVER, inInitCommServer);
	inAddFunctionPointer(RANGE_1TO4, (PFI_TO)inRange_1TO4);
	inAddFunctionPointer(VCS_SIGNAL_STRENGTH, inDisplaySignalStrength);

	
}

/* ----------------------------------------------------------------------------
   Name 		: inVCSCommLinkValidate
   Parameters	: pchValue - CommLinkType value from HDT
   Description	: This function was primarily written to validate the comm link type in HDT.
 			  The core function was not flexible enough for use
   Returns	: VS_SUCCESS if the value is a number, otherwise VS_ERROR
   ----------------------------------------------------------------------------
   History:
   August 27, 2004 - This function was created (Rannie_B1)
   ---------------------------------------------------------------------------- */
int inVCSCommLinkValidate(char* pchValue)
{
   int inResult;

   if (inIsDigits(pchValue) && (atoi(pchValue) > 0))
   {
      inResult = VS_SUCCESS;
   }
   else
   {
      inResult = VS_ERROR;
      vdSGErrorMessage(PLS_ENTER_PRT_OPTION_MSG21);
   }

   return(inResult);
}

/*********************************************************************************************
* @func int | inRange_1TO4 |
*       Determines if a value in the range of 1 to 4
*
* @parm char * | pchValue |
*       The value to be tested
*
* @rdesc return values.
* @flag int |  VS_ERR or VS_SUCCESS
* @end
**********************************************************************************************/
int inRange_1TO4(char* pchValue) {
    int inRetVal = VS_ERR;

    if (inIsDigits(pchValue) && inRange(atoi(pchValue), 1, 4))
        inRetVal = VS_SUCCESS;
    else
        vdSGErrorMessage(PLS_ENTER_OTO2_MSG21);

    return (inRetVal);
}


